//
//  SaApiManager.h
//  saas
//
//  Created by fangyibao on 2019/9/9.
//  Copyright © 2019 fangmao. All rights reserved.
//

#import <Foundation/Foundation.h>
extern const NSInteger Sa_Code_Error;
extern const NSInteger Sa_Code_Invalid;
extern const NSInteger Sa_Token_Invalid;
extern const NSInteger Sa_Request_Success;
extern const NSInteger Sa_Server_Error;
@protocol SaApiManagerProtocol<NSObject>
@required
- (NSString *)api;
- (NSString *)method;
@optional
- (NSString *)host;
@end
@interface SaApiManager : NSObject
@property (nonatomic, weak) id<SaApiManagerProtocol> child;
- (NSURLSessionDataTask *)dataTaskWithParam:(id)param completionHandler:(void (^)(NSURLResponse *response,id responseObject,NSError *error))completionHandler;
- (NSNumber *)dispatchTask:(NSURLSessionTask *)task;
- (NSNumber *)dispatchTaskWithParam:(id)param completionHandler:(void (^)(NSURLResponse *response,id responseObject,NSError *error))completionHandler;

- (NSURLSessionDataTask *)uploadImageWithParam:(id)param sourceImg:(UIImage *)img completionHandler:(void (^)(NSURLResponse *response,id responseObject,NSError *error))completionHandler; // 上传单张图片

- (NSURLSessionDataTask *)uploadImagesWithParam:(id)param imgs:(NSArray *)imgs completionHandler:(void (^)(NSURLResponse *response,id responseObject,NSError *error))completionHandler;

- (void)cancelAllTask;
- (void)cancelTaskWithTaskIdentifier:(NSNumber *)taskIdentifier;
@end


